package com.xiaomengkuan.test.controller;

import com.xiaomengkuan.test.dao.UserRepository;
import com.xiaomengkuan.test.entity.pojo.User;
import com.xiaomengkuan.test.util.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author Faraj Mujey
 * -- Creation Time: 2021-01-11 4:19 下午, File Encoding: utf8 --
 */
@RestController
@RequestMapping("test/user")
@CrossOrigin
public class UserController {
    @Resource
    UserRepository userRepository;
    @GetMapping("one/{id}")
    public R getOne(@PathVariable("id")int id){
        User one = userRepository.getOne(id);
        return R.OK().put("user",one);
    }
}
